package com.class4;

import web.WebKeyword;

public class ShopAdminTest {
    public static void main(String[] args) {
        WebKeyword web=new WebKeyword();
        web.openBrowser("chrome");
        web.visitPage("http://www.testingedu.com.cn:8000/Admin/Admin/login");
        web.setWindowSize(300,1600,1000);
        web.input("//input[@name='username']","admin");
        web.input("//input[@name='password']","123456");
        web.input("//input[@name='vertify']","1");
        web.clickButton("//input[@value='登录']");
        web.clickButton("//a[text()='商城']");
        web.switchFrame("workspace");
        web.clickButton("//span[text()='添加商品']");
        web.halt("1");
        web.input("//input[@name='goods_name' and @type='text' ]","忘记最靓的仔");
        web.clickButton("//select[@id='cat_id']");
        web.clickButton("//option[@value='31']");
        web.halt("0.5");
        web.selectByValue("//select[@id='cat_id_2']","34");
        web.halt("0.5");
        web.selectByText("//select[@id='cat_id_3']","忘仔牛奶");
        web.input("//input[@name='shop_price']","666");
        web.input("//input[@name='market_price']","668");
        web.clickButton("//*[@id='is_free_shipping_label_1']");
      //文件上传
        web.clickButton("//input[@onclick and contains(@title,'预览图')]");
        web.switchFrame("//iframe[contains(@id,'layui')]");
        web.upload("//div[text()='点击选择文件']/f ollowing-sibling::div/input","D:\\panda.jpg");
        web.halt("1");
        web.clickButton("//div[text()='确定使用']");
web.runJs("window.scrollTo(0,2000)");
web.switchFrame("ueditor 0");
web.runJSWithElement("//p","innerText='测试输入'");
web.switchParent();
web.clickButton("//a[@id='submit']");
web.halt("30");
//web.closeBrowser();
web.closeBrowser();

    }

}
